import request from '/@/utils/request';
import { Session } from '/@/utils/storage';
export const cleanMessage = (id: string | null) => {
	return request({
		url: `/aigc/message/clean/${id}`,
		method: 'delete',
	});
};

//获取聊天记录
export const getMessages = (id: String) => {
	return request({
		url: '/aigc/message/findList',
		method: 'post',
		data:{conversationId:id}
	});
};

// 聊天接口
export const chatCompletion = (data: Object,controller:AbortController) => {
	return request({
		url: '/aigc/chat/completions',
		method: 'post',
		responseType: 'stream',
		signal:controller.signal,
		data,
	});
};

// 生成图片接口
export const generateImage = (data: Object) => {
	return request({
		url: '/aigc/chat/image',
		method: 'post',
		data,
	});
};
//向量查询接口
export const embeddingSearch=(data: Object) => {
	return request({
		url: '/aigc/embedding/search',
		method: 'post',
		data,
	});
};
//获取聊天记录
export const getChatList = (params: Object) => {
	return request({
		url: '/aigc/app/list',
		method: 'get',
		params,
	});
};